import { ApiPropertyOptional } from '@nestjs/swagger'
import { arrayProp, modelOptions, prop, Ref } from '@typegoose/typegoose'
import { Episode } from './episode.model'
//视频数据库模型
//在数据库默认添加两个时间字段 
@modelOptions({
  schemaOptions:{
    timestamps:true
  }
})
export class Coures {
  //接口注释 和默认值
  @ApiPropertyOptional({description:'课程名称'})
  @prop()
  name:string

  @ApiPropertyOptional({description:'封面图片'})
  @prop()
  cover:string

  @ApiPropertyOptional({description:'课时'})
  @arrayProp({itemsRef:'Episode'})  //关联模型方式
  // @prop({ ref: () => Episode })
  episodes:Ref<Episode>[]
}